// pages/Goods/witness/index.js
var common = require("../../../public.js");
Page({
  data: {
    storeId: '',
    witnessList:[]
  },
  onLoad: function (opt) {
    console.log(opt.storeId)
    let that = this
    that.setData({
      storeId: opt.storeId
    }, _ => {
      that.getStoreMainPageInfoFunc()
    })
  },
  getStoreMainPageInfoFunc() {
    var that = this;
    var tempJson = {
      storeId: this.data.storeId
    };
    common.wxRequest("/store/mainPageInfo", "post", tempJson, 'application/x-www-form-urlencoded', function (res) {
      console.log('店铺返回值', res);
    
      that.setData({
        witnessList: res.data.witnessList,
        store: res.data.store
      })
    })
  },
  playWitness(e) { // 更新播放量
    console.log(e.currentTarget.dataset.id)
    let tempJson = {
      cwId: e.currentTarget.dataset.id
    }
    common.wxRequest("/store/updateWitnessClickNum", "post", tempJson, 'application/x-www-form-urlencoded', function (res) {})
  },

})